/*
import 'package:lib_rtc/lib_rtc.dart';
import 'package:lib_runtime/lib_runtime.dart';
import 'package:m_chatroom/src/rtc/rtc_mixin.dart';
import 'package:zego_express_engine/zego_express_engine.dart';

class ZegoRtc with RtcMixin {
  static const String streamPrefix = 'zego_stream_';

  final int appId = 2012710001;
  final String appSign =
      'd79bb297a81f628b00f23fffa9bdc64d3c2d1ccb9d36e68e65dc24f888d4b162';
  Set<String> streams = <String>{};

  @override
  Future<void> init() async {
    ZegoEngineProfile profile =
        ZegoEngineProfile(appId, ZegoScenario.Default, appSign: appSign);
    await ZegoExpressEngine.createEngineWithProfile(profile);

    ZegoExpressEngine.onRoomUserUpdate = (roomID, updateType, userList) {
      RLog.d(
          'Room user update, roomID: $roomID, updateType: $updateType userList: $userList');
    };

    ZegoExpressEngine.onRemoteSoundLevelUpdate =
        (Map<String, double> soundLevels) {
      List<AudioVolumeInfo> volumeInfo = <AudioVolumeInfo>[];
      soundLevels.forEach((key, value) {
        volumeInfo.add(AudioVolumeInfo(
            uid: NumUtil.parseInt(key.replaceAll(streamPrefix, '')),
            volume: value.toInt(),
            vad: 1,
            voicePitch: 0.0));
      });
      onVolumeInfo(volumeInfo);
    };

    ZegoExpressEngine.onRoomStreamUpdate =
        (roomID, updateType, streamList, extendedData) {
      RLog.d(
          'Room stream update, roomID: $roomID, updateType: $updateType streamList: $streamList extendedData: $extendedData');

      var newStreams = streamList.map((e) => e.streamID).toSet();

      // 停止 移除的流
      streams.difference(newStreams).forEach((_) {
        _engine.stopPlayingStream(_);
      });

      // 拉 新加的流
      newStreams.difference(streams).forEach((_) {
        _engine.startPlayingStream(_);
      });

      streams = newStreams;
    };

    RLog.d('🚀 Create ZegoExpressEngine');
  }

  @override
  Future<void> joinRoom() async {
    // Instantiate a ZegoUser object
    ZegoUser user =
        ZegoUser('${currUser?.id.toInt()}', '${currUser?.nickname}');

    RLog.d('Start login room, roomID: ${rtcConfig.rid}');

    ZegoRoomConfig config = ZegoRoomConfig.defaultConfig();
    config.isUserStatusNotify = true;
    config.token = rtcConfig.token;

    // Login Room
    _engine.loginRoom('${rtcConfig.rid}', user, config: config);

    await _engine.startSoundLevelMonitor(
        config: ZegoSoundLevelConfig(400, true));
  }

  @override
  Future<void> leaveChannel() async {
    _engine.stopPublishingStream();
    _engine.logoutRoom(rtcConfig.channelId);
  }

  @override
  Future<void> openMic() => _engine.startPublishingStream(publishStream);

  @override
  Future<void> closeMic() => _engine.stopPublishingStream();

  @override
  Future<void> setBroadcaster() async {
    await super.setBroadcaster();
    await _engine.startPublishingStream(publishStream);
  }

  @override
  Future<void> setAudience() async {
    await super.setAudience();
    await _engine.stopPublishingStream();
  }

  ZegoExpressEngine get _engine => ZegoExpressEngine.instance;

  String get publishStream => '$streamPrefix${currUser?.id.toInt()}';
}
*/
